package com.truesai.entities.price;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.truesai.dto.WeightInPriceCycle;
import com.truesai.entities.production.Production;

/**
 * 产品加权进价表<br/>
 * 需求分析<br/>
 * <strong>唯一性:</strong>产品id
 * @author XuLian
 *
 */
@Entity
@NamedQueries(
{
        @NamedQuery(name = DateZoneWeightInPrice.ALL, query = "Select wip from DateZoneWeightInPrice wip"),
        @NamedQuery(name = DateZoneWeightInPrice.BY_MARK_ID, query = "Select wip from DateZoneWeightInPrice wip where wip.production = :production"),
        @NamedQuery(name = DateZoneWeightInPrice.BY_ID, query = "Select wip from DateZoneWeightInPrice wip where wip.id = :id") })
@Table(name = "DateZoneWeight_InPrices")
public class DateZoneWeightInPrice {
	public static final String ALL = "DateZoneWeightInPrice.all";

    public static final String BY_MARK_ID = "DateZoneWeightInPrice.byProductionId";

    public static final String BY_ID = "DateZoneWeightInPrice.byId";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**产品*/
    @ManyToOne
    private Production production;
    
    /**产品进价*/
    @Column(scale=2)
    private BigDecimal inPrice;
    
    /**加权周期*/
    @Column
    @Enumerated(EnumType.ORDINAL)
    private WeightInPriceCycle cycle;
    
    /**加权起算日期*/
    @Column
    private Date beginDate;
    
    /**加权计算结束日期*/
    @Column
    private Date endDate;
    
    /**月度第几周*/
    @Column
    private Integer monthOfWeek;
    
    /**月度*/
    @Column
    private Integer month;
    
    /**年度*/
    @Column
    private Integer year;
    
    
    public DateZoneWeightInPrice() { }
    
    public DateZoneWeightInPrice(Production production, BigDecimal inPrice,
    		WeightInPriceCycle cycle, Date beginDate, Date endDate,
    		Integer monthOfWeek, Integer month, Integer year) {
    	this.production = production;
    	this.inPrice = inPrice;
    	this.cycle = cycle;
    	this.beginDate = beginDate;
    	this.endDate = endDate;
    	this.monthOfWeek = monthOfWeek;
    	this.month = month;
    	this.year = year;
    }

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Production getProduction() {
		return production;
	}

	public void setProduction(Production production) {
		this.production = production;
	}

	public BigDecimal getInPrice() {
		return inPrice;
	}

	public void setInPrice(BigDecimal inPrice) {
		this.inPrice = inPrice;
	}
	

}
